<%@ Page Title="CMS_Message List" Language="C#" AutoEventWireup="true" CodeBehind="CMS_MessageList.aspx.cs" Inherits="Youz.CreditRepay.Manage.CMS_MessageList" %>

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-bell"></i><span style="font-size: 16px; padding-right: 15px;">系统消息</span></h2>
            </div>
            <div class="panel-body">

                <form class="form-horizontal">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-3 control-label">接收会员</label>
                                <div class="col-md-9">
                                    <input type="text" class="form-control" id="MemberAccount">
                                </div>
                            </div>
                        </div>

                        <div class="col-md-2">
                            <button type="button" id="btnSearch" onclick="initPager()" class="btn btn-sm btn-primary"><i class="fa fa-search"></i>查询</button>
                        </div>

                    </div>
                </form>

                <table class="table table-bordered table-striped " id="table">
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>标题</th>
                            <th>接收会员</th>
                            <th>是否已读</th>
                            <th>创建时间</th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <div id="pager"></div>
            </div>
        </div>
    </div>
</div>

<script type="text/template" id="templist">
    <# 
            for (var i = 0; i < rows.length; i++) {
                  var item = rows[i];
        #>
            <tr>
                <td><#=item.RowIndex #></td>
                <td><#=item.Title #></td>
                <td><#=item.MemberAccount #></td>
                <td><#=fYesNo(item.IsRead) #></td>
                <td><#=item.CreateTime #></td>
            </tr>
    <tr>
        <td colspan="5"><#=item.Content #></td>
    </tr>
    <#
            }
        #>
</script>
<script type="text/javascript">

    $(function () {
        initPager();
    });

    function initPager() {
        $("#pager").pagination({
            items_per_page: 15,
            prev_text: "上一页",
            next_text: "下一页",
            url: 'CMS/Handlers/CMS_MessageHandler.ashx?type=list',
            queryParams: {
                MemberAccount: $("#MemberAccount").val()
            },
            callback: function (opts) {
                var html = parseTemplate($("#templist").html(), opts.data);
                $("#table tbody").html(html);
            }
        });
    }

</script>
